﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Sexybeauty.Core.Biz;
using Sexybeauty.Core.Inf.LogicEntity;
using Sexybeauty.Framework.Common;
using System.Text.RegularExpressions;

namespace Sexybeauty.Web.Controllers
{
    [Authorize]
    public class MemberController : Controller
    {
        public ActionResult Index()
        {
            MemberEntity user = UserBiz.GetCurrentUser(true);
            if (user == null)
            {
                return Redirect("/home/index");
            }
            ViewBag.User = user;

            List<MemberResourceEntity> photos = UserBiz.GetResources(HttpContext.User.Identity.Name, CustomerFileLevel.Public, CustomerFileType.Photo, 0, 12);
            ViewBag.Album = photos;

            List<MemberEntity> Frends = UserBiz.GetFrendsDetail(HttpContext.User.Identity.Name, 0, 2);
            ViewBag.Frend = Frends;
            return View();
        }

        [HttpPost]
        public ActionResult resetinfo(string nickname,string words, int gender, string birthday, int area, int role, string qq, string phone)
        {
            if (!String.IsNullOrEmpty(nickname) && !String.IsNullOrEmpty(birthday))
            {
                UserBiz.UpdateBaseInfo(HttpContext.User.Identity.Name, words, nickname, gender, birthday, area, role, qq, phone);
                    
            }
            return Redirect("/member/index");
        }
    }
}
